home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{72D18DD4-0DA7-11D2-8E21-00B404C10000}#2.1#0"; "ODCboLst.ocx"
- Begin VB.Form frmTest
- Caption = "Owner Draw Combo Box Tester"
- ClientHeight = 8475
- ClientLeft = 3765
- ClientTop = 2130
- ClientWidth = 7740
- BeginProperty Font
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Icon = "Test.frx":0000
- LinkTopic = "Form1"
- ScaleHeight = 8475
- ScaleWidth = 7740
- Begin ODCboLst.OwnerDrawComboList cboFonts
- Height = 360
- Left = 120
- TabIndex = 6
- Top = 4020
- Width = 3015
- _ExtentX = 5318
- _ExtentY = 635
- Sorted = -1 'True
- ExtendedUI = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- ClientDraw = 7
- Style = 0
- End
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 435
- Left = 5940
- TabIndex = 14
- Top = 5940
- Width = 1095
- End
- Begin VB.Timer tmrFocus
- Interval = 250
- Left = 3600
- Top = 3120
- End
- Begin ODCboLst.OwnerDrawComboList lstMultiSelect
- Height = 1815
- Left = 4800
- TabIndex = 12
- Top = 3960
- Width = 2835
- _ExtentX = 5001
- _ExtentY = 3201
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- Style = 6
- End
- Begin ODCboLst.OwnerDrawComboList cboCursors
- Height = 360
- Left = 4740
- TabIndex = 10
- Top = 2640
- Width = 2895
- _ExtentX = 5106
- _ExtentY = 635
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- Style = 0
- End
- Begin ODCboLst.OwnerDrawComboList lstSysColours
- Height = 1995
- Left = 4740
- TabIndex = 9
- Top = 300
- Width = 2955
- _ExtentX = 5212
- _ExtentY = 3519
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- ClientDraw = 5
- Style = 4
- End
- Begin ODCboLst.OwnerDrawComboList cboSysColor
- Height = 360
- Left = 120
- TabIndex = 0
- Top = 360
- Width = 1875
- _ExtentX = 3307
- _ExtentY = 635
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- ClientDraw = 5
- End
- Begin ODCboLst.OwnerDrawComboList cboColorPicker
- Height = 360
- Left = 120
- TabIndex = 3
- Top = 1800
- Width = 1995
- _ExtentX = 3519
- _ExtentY = 635
- ExtendedUI = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- ClientDraw = 3
- End
- Begin ODCboLst.OwnerDrawComboList cboStyles
- Height = 360
- Left = 120
- TabIndex = 5
- Top = 3180
- Width = 3015
- _ExtentX = 5318
- _ExtentY = 635
- ExtendedUI = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- ClientDraw = 6
- Style = 0
- End
- Begin ODCboLst.OwnerDrawComboList lstCheck
- Height = 1335
- Left = 180
- TabIndex = 7
- Top = 4860
- Width = 4155
- _ExtentX = 7329
- _ExtentY = 2355
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "Tahoma"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = -2147483630
- Style = 7
- End
- Begin ODCboLst.OwnerDrawComboList lstMultiCol
- Height = 1875
- Left = 180
- TabIndex = 8
- Top = 6540
- Width = 7455
- _ExtentX = 13150
- _ExtentY = 3307
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Style = 4
- End
- Begin VB.CheckBox chkEnabled
- Caption = "&Enabled"
- Enabled = 0 'False
- Height = 195
- Left = 4800
- TabIndex = 13
- Top = 5880
- Width = 2835
- End
- Begin VB.CheckBox chkShowNames
- Caption = "&Show Names"
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 2400
- Value = 1 'Checked
- Width = 1995
- End
- Begin VB.PictureBox picColorSample
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 855
- Left = 2160
- ScaleHeight = 795
- ScaleWidth = 915
- TabIndex = 20
- TabStop = 0 'False
- Top = 1800
- Width = 975
- End
- Begin VB.CheckBox chkVisible
- Caption = "Selection &Invisible"
- Height = 195
- Left = 120
- TabIndex = 2
- Top = 1080
- Value = 1 'Checked
- Width = 1935
- End
- Begin VB.CommandButton cmdLoad
- Caption = "&Load..."
- Height = 375
- Left = 4800
- TabIndex = 11
- Top = 3180
- Width = 1035
- End
- Begin VB.CommandButton cmdShow
- Caption = "v"
- Height = 375
- Left = 3240
- TabIndex = 1
- Top = 420
- Width = 375
- End
- Begin VB.PictureBox picSample
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 855
- Left = 2160
- ScaleHeight = 795
- ScaleWidth = 915
- TabIndex = 15
- TabStop = 0 'False
- Top = 420
- Width = 975
- End
- Begin VB.Label lblFocus
- Caption = "Label7"
- Height = 315
- Left = 3480
- TabIndex = 26
- Top = 3600
- Width = 1035
- End
- Begin VB.Label Label6
- Caption = "Multi Column List Box:"
- Height = 195
- Left = 180
- TabIndex = 25
- Top = 6300
- Width = 7395
- End
- Begin VB.Label lblCheck
- Caption = "Checked List Box:"
- Height = 195
- Left = 180
- TabIndex = 24
- Top = 4620
- Width = 3135
- End
- Begin VB.Label Label5
- Caption = "Font Chooser Combo:"
- Height = 195
- Left = 180
- TabIndex = 23
- Top = 3780
- Width = 3015
- End
- Begin VB.Label Label4
- Caption = "As a Multi Select List Box:"
- Height = 195
- Left = 4800
- TabIndex = 22
- Top = 3660
- Width = 2775
- End
- Begin VB.Label lblDefault
- Caption = "Default Draw Using Imagelist"
- Height = 255
- Left = 4800
- TabIndex = 21
- Top = 2400
- Width = 2775
- End
- Begin VB.Label Label3
- Caption = "Colour Picker Combo:"
- Height = 195
- Left = 120
- TabIndex = 19
- Top = 1560
- Width = 3075
- End
- Begin VB.Label Label2
- Caption = "Sys Colour Picker as a List Box:"
- Height = 195
- Left = 4740
- TabIndex = 18
- Top = 60
- Width = 2775
- End
- Begin VB.Label Label1
- Caption = "Paragraph Style Chooser Combo:"
- Height = 195
- Left = 180
- TabIndex = 17
- Top = 3000
- Width = 3015
- End
- Begin VB.Label lblSysCol
- Caption = "Sys Colour Picker as a ComboBox:"
- Height = 195
- Left = 120
- TabIndex = 16
- Top = 120
- Width = 3075
- End
- Attribute VB_Name = "frmTest"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub AddStyles()
- Dim sFnt As New StdFont, lHeight As Long
- lHeight = 32
- With cboStyles
- sFnt.Name = "Arial"
- sFnt.Size = 14
- sFnt.Bold = True
- sFnt.Italic = False
- Set Me.Font = sFnt
- .AddItemAndData "Heading 1", , 8, , , sFnt.Size, , lHeight, , eixVCentre, sFnt
- sFnt.Name = "Arial"
- sFnt.Size = 12
- sFnt.Bold = False
- sFnt.Italic = True
- Set Me.Font = sFnt
- .AddItemAndData "Heading 2", , 8, , , sFnt.Size, , lHeight, , eixVCentre, sFnt
- sFnt.Name = "Arial"
- sFnt.Size = 10
- sFnt.Bold = True
- sFnt.Italic = False
- Set Me.Font = sFnt
- .AddItemAndData "Heading 3", , 8, , , sFnt.Size, , lHeight, , eixVCentre, sFnt
- sFnt.Name = "Times New Roman"
- sFnt.Size = 10
- sFnt.Bold = False
- sFnt.Italic = False
- Set Me.Font = sFnt
- .AddItemAndData "Normal", , 8, , , sFnt.Size, , lHeight, , eixVCentre, sFnt
- .AddItemAndData "Centred", , 8, , , sFnt.Size, , lHeight, eixCentre, eixVCentre, sFnt
- sFnt.Name = "Courier New"
- sFnt.Size = 8
- sFnt.Bold = False
- sFnt.Italic = False
- Set Me.Font = sFnt
- .AddItemAndData "Code", , 8, , , sFnt.Size, , lHeight, , eixVCentre, sFnt
- sFnt.Name = "Arial"
- sFnt.Size = 10
- sFnt.Bold = False
- sFnt.Italic = False
- sFnt.Underline = True
- Set Me.Font = sFnt
- .AddItemAndData "Followed Hyperlink", , 8, &H800080, , sFnt.Size, , lHeight, , eixVCentre, sFnt
- .AddItemAndData "Hyperlink", , 8, &HFF0000, , sFnt.Size, , lHeight, , eixVCentre, sFnt
- .DropDownWidth = 220
- .DoAutoComplete = True
- .AutoCompleteListItemsOnly = True
- End With
- End Sub
- Private Sub cboColorPicker_Click()
- picColorSample.BackColor = cboColorPicker.ItemBackColor(cboColorPicker.ListIndex)
- End Sub
- Private Sub cboCursors_Change()
- Debug.Print "cboCursors_Change"
- End Sub
- Private Sub cboCursors_Click()
- Debug.Print "cboCursors_Click"
- End Sub
- Private Sub cboCursors_GotFocus()
- Debug.Print "cboCursors:LostFocus"
- End Sub
- Private Sub cboCursors_KeyDown(KeyCode As Integer, Shift As Integer)
- Debug.Print "cboCursors_KeyDown", KeyCode, Shift
- End Sub
- Private Sub cboCursors_KeyPress(KeyAscii As Integer)
- Debug.Print "cboCursors_KeyPRess", KeyAscii
- Dim sC As String
- sC = Chr$(KeyAscii)
- KeyAscii = Asc(UCase$(sC))
- End Sub
- Private Sub cboCursors_LostFocus()
- Debug.Print "cboCursors:LostFocus"
- End Sub
- Private Sub cboCursors_ODGotFocus()
- Debug.Print "cboCursors:ODGotFocus"
- End Sub
- Private Sub cboCursors_ODLostFocus()
- Debug.Print "cboCursors:ODLostFocus"
- End Sub
- Private Sub cboSysColor_Click()
- picSample.BackColor = cboSysColor.ItemBackColor(cboSysColor.ListIndex)
- End Sub
- Private Sub cboSysColor_CloseUp()
- If (chkVisible.Value = 1) Then
- cmdShow.SetFocus
- End If
- End Sub
- Private Sub chkEnabled_Click()
- cboCursors.Enabled = -1 * chkEnabled.Value
- lstMultiSelect.Enabled = -1 * chkEnabled.Value
- End Sub
- Private Sub chkShowNames_Click()
- If (chkShowNames.Value = 1) Then
- cboColorPicker.ClientDraw = ecdColourPickerWithNames
- Else
- cboColorPicker.ClientDraw = ecdColourPickerNoNames
- End If
- End Sub
- Private Sub chkVisible_Click()
- cboSysColor.Visible = (chkVisible - 1) * -1
- End Sub
- Private Sub cmdLoad_Click()
- Dim sFile As String
- Dim iCount As Integer
- Dim iImgCount As Integer
- Dim i As Long
- Dim sLC As String
- If cboCursors.Tag = "" Then
- cboCursors.ImageList = cboCursors.InternalImageList.hIml
- iImgCount = cboCursors.InternalImageList.ImageCount
- sFile = Dir(App.Path & "\Images\*.*")
- Do While sFile <> ""
- iCount = iCount + 1
- cboCursors.InternalImageList.AddFromFile App.Path & "\Images\" & sFile, IMAGE_ICON
- iImgCount = iImgCount + 1
- If (iCount = 1) Then
- cboCursors.AddItemAndData UCase$(Left$(sFile, 1)), , 2
- iCount = iCount + 1
- Else
- If (UCase$(Left$(sFile, 1)) <> sLC) Then
- cboCursors.ItemUnderLine(iCount - 2) = True
- cboCursors.AddItemAndData UCase$(Left$(sFile, 1)), , 2
- iCount = iCount + 1
- End If
- End If
- sLC = UCase$(Left$(sFile, 1))
- cboCursors.AddItemAndData sFile, (iImgCount - 1), 8, , , iCount, , 20
- sFile = Dir
- Loop
- If (iCount > 0) Then
- chkEnabled.Enabled = True
- chkEnabled.Value = 1
- cboCursors.ListIndex = 0
- cmdLoad.Enabled = False
- lstMultiSelect.ImageList = cboCursors.InternalImageList.hIml
- For i = 0 To cboCursors.ListCount - 1
- lstMultiSelect.AddItemAndData cboCursors.List(i), cboCursors.ItemIcon(i), cboCursors.ItemIndent(i), , , cboCursors.ItemData(i), , cboCursors.itemHeight(i) - 2
- Next i
- Else
- MsgBox "No images found in the path: " & App.Path & "\Images\*.*", vbInformation
- End If
- cboCursors.Tag = "LOADED"
- cboCursors.DoAutoComplete = True
- cboCursors.AutoCompleteItemsAreSorted = True
- cboCursors.AutoCompleteListItemsOnly = True
- End If
- End Sub
- Private Sub cmdShow_Click()
- Dim x As Long, y As Long
- x = cmdShow.Left \ Screen.TwipsPerPixelX
- y = 1 + (cmdShow.Top + cmdShow.Height) \ Screen.TwipsPerPixelY
- cboSysColor.ShowDropDownAtPosition x, y
- End Sub
- Private Sub Command1_Click()
- lstMultiCol.SetFocus
- End Sub
- Private Sub Form_Load()
- cboSysColor.DropDownWidth = (cboSysColor.Width * 2) \ Screen.TwipsPerPixelX
- ' Set up the colour picker combo:
- With cboColorPicker
- .AddItemAndData "Black", , , , vbBlack
- .AddItemAndData "Dark Red", , , , &H80&
- .AddItemAndData "Dark Green", , , , &H8000&
- .AddItemAndData "Ochre", , , , &H8080&
- .AddItemAndData "Dark Blue", , , , &H800000
- .AddItemAndData "Purple", , , , &H800080
- .AddItemAndData "Turquoise", , , , &H808000
- .AddItemAndData "Silver", , , , &HC0C0C0
- .AddItemAndData "Gray", , , , &H808080
- .AddItemAndData "Red", , , , vbRed
- .AddItemAndData "Green", , , , vbGreen
- .AddItemAndData "Yellow", , , , vbYellow
- .AddItemAndData "Blue", , , , vbBlue
- .AddItemAndData "Magenta", , , , vbMagenta
- .AddItemAndData "Cyan", , , , vbCyan
- .AddItemAndData "White", , , , vbWhite
- .ListIndex = 0
- End With
- ' Select the first font:
- If (cboFonts.ListCount = 0) Then
- cboFonts.AddItem "No fonts available"
- cboFonts.Enabled = False
- Else
- cboFonts.DoAutoComplete = True
- cboFonts.AutoCompleteItemsAreSorted = True
- cboFonts.AutoCompleteListItemsOnly = True
- End If
- cboFonts.ListIndex = 0
- ' Set up available styles:
- AddStyles
- ' Add some items to the checked list box:
- With lstCheck
- .AddItem "File Menu Items"
- .AddItemAndData "Open", , 16
- .AddItemAndData "Save", , 16
- .AddItemAndData "Exit", , 16
- End With
- ' Set up the multi-column list box:
- Dim lW As Long, i As Long
- With lstMultiCol
- .Columns = 4
- lW = lstMultiCol.Width \ Screen.TwipsPerPixelX * 8
- .ColWidth(1) = lW * 3
- .ColWidth(2) = lW
- .ColWidth(3) = 2 * lW
- .ColWidth(4) = 2 * lW
- .ImageList = .InternalImageList.hIml
- For i = 1 To 10
- .AddItemAndData ("Quite a reasonably long item for column 1, row" & i & vbTab & "Col2" & i & vbTab & Format$(Now, "hh:mm:ss") & vbTab & i), Rnd * 7
- Next i
- .FullRowSelect = True
- End With
- End Sub
- Private Sub lstCheck_Click()
- Debug.Print "Check_Click"
- End Sub
- Private Sub lstCheck_KeyPress(KeyAscii As Integer)
- Dim lI As Long
- If (KeyAscii = 13) Then
- lI = lstCheck.ListIndex
- If (lI > -1) Then
- 'lstCheck.Selected(lI) = Not (lstCheck.Selected(lI))
- End If
- End If
- End Sub
- Private Sub lstMultiCol_Click()
- Debug.Print "MultiCol_Click" & lstMultiCol.List(lstMultiCol.ListIndex)
- End Sub
- Private Sub lstSysColours_Change()
- Debug.Print "Colour:Change"
- End Sub
- Private Sub lstSysColours_Click()
- Debug.Print "Colour:Click"
- End Sub
- Private Sub lstSysColours_KeyDown(KeyCode As Integer, Shift As Integer)
- Debug.Print "Colour:KeyDown", KeyCode, Shift
- End Sub
- Private Sub lstSysColours_KeyPress(KeyAscii As Integer)
- Debug.Print "Colour:KeyPress", KeyAscii
- End Sub
- Private Sub lstSysColours_KeyUp(KeyCode As Integer, Shift As Integer)
- Debug.Print "Colour:KeyUp"
- End Sub
- Private Sub lstMultiCol_FocusChange(bForward As Boolean)
- 'ParseFocusChange lstMultiCol.TabIndex, Not (bForward)
- If (bForward) Then
- Command1.SetFocus
- Else
- lstCheck.SetFocus
- End If
- End Sub
- Private Sub lstMultiCol_KeyDown(KeyCode As Integer, Shift As Integer)
- Debug.Print "MultiCol:KEYDOWN", KeyCode, Shift
- End Sub
- Private Sub lstMultiSelect_KeyDown(KeyCode As Integer, Shift As Integer)
- Debug.Print KeyCode, Shift
- End Sub
- Private Sub picSample_Click()
- Set cboStyles.Font = Me.Font
- End Sub
- Private Sub tmrFocus_Timer()
- If Not (Me.ActiveControl Is Nothing) Then
- lblFocus.Caption = Me.ActiveControl.Name
- Else
- lblFocus.Caption = "<none>"
- End If
- End Sub
-